import instance from "@/util/axios.js"
// 登录
export const login = async ({
        studentId,
        loginPwd
    }) =>
    await instance.post('/api/student/login', {
        studentId,
        loginPwd
    })

// 注册
export const register = async (data) =>
    await instance.post("/api/student/register", data, {
        headers: {
            'Content-Type': `multipart/form-data;`,
        }
    })
// 找回密码
export const retrieve = async (data) =>
    await instance.put("/api/student/find", data)

// 获取用户信息
export const getIfon = async () =>
    await instance.get("/api/student/Information")

// 获取付款二维码
export const getQRCode = async (data) =>
    await instance.get("/api/student/getQRCode", {
        params: {
            ...data
        }
    })

// 起床打卡
export const getUp = async () =>
    await instance.put("/api/student/getUp")

// 归宿打卡
export const returns = async () =>
    await instance.put("/api/student/returns")
// 打扫登记
export const clean = async () =>
    await instance.post("/api/student/clean")

// 获取是否打卡
export const getIsSignIn = async (obtainWho) =>
    await instance.get(`/api/student/getIsSignIn/${obtainWho}`)

// 获取打卡记录
export const getCheckInRecords = async (data) => {
    return await instance.get("/api/student/getCheckInRecords", {
        params: {
            ...data
        }
    })
}
// 获取宿舍评价
export const getEvaluate = async (data) =>
    await instance.get("/api/currency/getEvaluate", {
        params: {
            ...data
        }
    })

// 修改信息
export const updateInformation = async (data) =>
    await instance.put("/api/student/modifyInformation", data, {
        headers: {
            'Content-Type': `multipart/form-data;`,
        }
    })

// 修改密码
export const updataLoginPwd = async (data) =>
    await instance.put("/api/student/updataLoginPwd", data)
/**
 * 查询订单号
 */
export const queryOrder = async (Order) =>
    await instance.get("/queryOrder", {
        params: {
            Order
        }
    })
/**
 * 入住
 */
export const checkIn = async (data) =>
    await instance.post("/api/student/checkIn", data)


/**
 * 报修
 * @param {number} RoomId 宿舍id
 * @param {String} RepairDescription 报修描述
 * @param {String} RepairImg 报修图片
 * @param {string} RepariDormitroy 报修宿舍楼
 * @param {string} RepariFloor 报修楼层
 * @param {string} RepariRoomNo 报修房间
 */
export const RepairReport = async (data) =>
    await instance.post("/api/student/RepairReport", data, {
        headers: {
            'Content-Type': `multipart/form-data;`,
        }
    })
/**
 * 获取维修记录
 * @param {string} startTime 起始时间
 * @param {string} endTime 终止时间
 * @param {Array} dormitroyId 宿舍楼id
 * @param {number} floorId 楼层id
 * @param {number} roomId 宿舍id
 * @param {number} isHandle 是否处理(1. 处理 2.未处理)
 * @param {number} page 第几页
 * @param {number} limit  每页几条
 */
export const getMainRecords = async (data) =>
    await instance.get("/api/currency/getMainRecords", {
        params: data
    })